include_once("assets/snippets/shoppingCart/kiwee.class.php");
include_once("assets/snippets/shoppingCart/dbconfig.inc.php");
include_once ("manager/includes/controls/datagrid.class.php");
	
$kiwee = new Kiwee();

$curriso = $_SESSION['CURRENCY']; 
$currate = $kiwee->getCurRate($curriso);
$cursym = $kiwee->getCurSym($curriso);

echo '<style type="text/css">';

echo '.grid {';
echo '    width: 100%;';
echo '    background-color: #fff;';
echo '    border: 1px solid silver;}';

echo '.gridHeader {';
echo '    color: #fff;';
echo '    font-weight: bold;';
echo '    background-color: #2095B2;'; // was 8FC70C 14D0FF
echo '    height: 25px;';
echo '    border: 1px solid #177084; }'; // was 006400 2B75FF 0400FF

echo '.gridItem {';
echo '    background-color: #fff;';
echo '    padding: 3px; }';

echo '.gridAltItem {';
echo '    background-color: #eeeeee;';
echo '    padding: 3px; }';

echo '.gridRowIcon:hover {';
echo '    background-color: #f5f5dc;'; // was f5f5dc
echo '}';

echo '</style>';
echo '<br />';
$sessionid = session_id();

$kiwee->createCart($sessionid);

        $res = $kiwee->db->sel($kiwee->config['fpx'], 'cart_header', 'id','session_id="' . $sessionid . '"');
        $hid = $res[0];
        $sql = 'SELECT A.id, name, A.totalprice, quantity, item_id, amount, options, optionsprice FROM ' . $kiwee->config['fpx'] . 'cart_detail AS A INNER JOIN ' . $kiwee->config['fpx'] . 'items AS B ON A.item_id=B.id WHERE header_id=' . $hid['id'];
        $dds = mysql_query($sql) or die ("MYSQL: " . mysql_error());
		
		
	
	$x = 0;
	while($row = mysql_fetch_array($dds))
  {
	$ds[$x] = $row;
	
	$a = $ds[$x][2];
	$b = round($currate*$a);
    $ds[$x][2]= $cursym."  ".number_format($b, 2)." ".$curriso;
	
	
	$a = $ds[$x]['amount'];
	$b = round($currate*$a);
    $ds[$x]['amount']= $cursym."  ".number_format($b, 2)." ".$curriso;

	$a = $ds[$x]['optionsprice'];
	$b = round($currate*$a);
    $ds[$x]['optionsprice']= $cursym."  ".number_format($b, 2)." ".$curriso;
	
	$x = $x+1;

  }

		

	$grd = new DataGrid('',$ds, $number_of_results);

	$grd->noRecordMsg = "No Items in Cart";

	$grd->cssClass="grid";

	$grd->columnHeaderClass="gridHeader";

	$grd->itemClass="gridItem";
 
    $grd->altItemClass="gridAltItem";

	$grd->fields="item_id, name, totalprice, quantity";

	$grd->columns= "SKU, Name, Total, Qty"; 

	$grd->colWidths="50,300,50,65,65,65";

	$grd->colAligns="left, left, center,center";

	$grd->colTypes=",template:<strong>[+name+]</strong><br /><br />Unit Price:&nbsp;&nbsp;[+amount+]<br />Options Price:&nbsp;&nbsp;[+optionsprice+]<br /><br />[+options+],,";

	if($listmode=='1') $grd->pageSize=0;

	if($_REQUEST['op']=='reset') $grd->pageNumber = 1;

echo '<input type="hidden" name="id" value="' . $id . '" />';
echo '<input type="hidden" id="sessionid" value="' . session_id() . '" />';

echo '<input type="hidden" name="listmode" value="' . $listmode . '" />';

echo '<input type="hidden" name="op" value="" />';
echo '<div id="shoppingcartdiv">';
	echo $grd->render();
echo '</div>';